<?php

namespace App\Admin\Controllers\Business;

use App\Admin\Models\Customers;
use App\Http\Controllers\Controller;
use Encore\Admin\Grid;
use Encore\Admin\Layout\Content;

class CustomerController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->title('用户')
            ->description('小程序用户列表')
            ->row($this->grid());
    }

    public function grid()
    {
        $grid = new Grid(new Customers());

        $grid->column('id', __('ID'));
        $grid->column('name', '名称');
        $grid->column('sex', '性别')->using([1 => '男', 2 => '女',]);
        $grid->column('status', '状态')->using([1 => '激活', 2 => '禁用',])->label([1 => 'danger', 2 => 'success']);
        $grid->column('money', "余额");
        $grid->column('goods_vip', '买家VIP')->using([0 => '否', 1 => '是',]);
        $grid->column('created_at', '注册时间');
        $grid->column('updated_at', '更新时间');
        return $grid;
    }
}
